package com.t174.car.controller;

import com.t174.car.dao.CarPurchaseDao;
import com.t174.car.entity.CarPurchase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.SimpleDateFormat;
import java.util.List;

@Controller
@RequestMapping("/carpurchase")
@Scope("prototype")
public class CarPurchaseController {
    @Autowired
    CarPurchaseDao carPurchaseDao;

    @RequestMapping("/query")
    @ResponseBody
    public List<CarPurchase> query(CarPurchase carPurchase){
        System.out.println(carPurchase.getMaxDate());
        System.out.println(carPurchase.getMinDate());
        System.out.println(carPurchase.getMaxPrice());
        System.out.println(carPurchase.getMinPrice());
        List<CarPurchase> list = carPurchaseDao.query(carPurchase);
        return list;
    }
}
